package pro.cherish.knowledgeumldesignpattern.designPattern.com.cherish.observer;

public class ObserverA implements Observer{
// myState 需要跟目标对象的state值保持一致
    private int myState;
    @Override
    public void update(Subject subject) {
        System.out.println("目标对象改变了");
        myState=((ConcreteSubject)subject).getState();
    }

    public int getMyState() {
        return myState;
    }

    public void setMyState(int myState) {
        this.myState = myState;
    }
}
